(global.webpackJsonp = global.webpackJsonp || []).push([ [ "shop/order/confirmOrder" ], {
    "0976": function(e, t, o) {
        o.r(t);
        var r = o("4f29"), a = o.n(r);
        for (var i in r) "default" !== i && function(e) {
            o.d(t, e, function() {
                return r[e];
            });
        }(i);
        t.default = a.a;
    },
    "0f35": function(e, t, o) {
        o.d(t, "b", function() {
            return r;
        }), o.d(t, "c", function() {
            return a;
        }), o.d(t, "a", function() {});
        var r = function() {
            var e = this, t = (e.$createElement, e._self._c, 1 == e.good_type ? parseFloat(e.orderComputeInfo.postage) : null);
            e.$mp.data = Object.assign({}, {
                $root: {
                    m0: t
                }
            });
        }, a = [];
    },
    1573: function(e, t, o) {
        (function(e) {
            o("1067"), r(o("66fd"));
            var t = r(o("f361"));
            function r(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            wx.__webpack_require_UNI_MP_PLUGIN__ = o, e(t.default);
        }).call(this, o("543d").createPage);
    },
    "4f29": function(e, t, o) {
        (function(e) {
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.default = void 0;
            var r = o("26cb"), a = o("a71e"), i = o("8434"), n = function(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }(o("03b8")), s = o("8f9b"), d = o("9b04"), c = o("db8f"), u = o("0cc1"), f = (o("b806"), 
            o("7960")), p = o("4771");
            function l(e, t) {
                var o = Object.keys(e);
                if (Object.getOwnPropertySymbols) {
                    var r = Object.getOwnPropertySymbols(e);
                    t && (r = r.filter(function(t) {
                        return Object.getOwnPropertyDescriptor(e, t).enumerable;
                    })), o.push.apply(o, r);
                }
                return o;
            }
            function _(e, t, o) {
                return t in e ? Object.defineProperty(e, t, {
                    value: o,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : e[t] = o, e;
            }
            var y = "", h = {
                components: {},
                computed: function(e) {
                    for (var t = 1; t < arguments.length; t++) {
                        var o = null != arguments[t] ? arguments[t] : {};
                        t % 2 ? l(Object(o), !0).forEach(function(t) {
                            _(e, t, o[t]);
                        }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : l(Object(o)).forEach(function(t) {
                            Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t));
                        });
                    }
                    return e;
                }({}, (0, r.mapGetters)([ "configs", "mainColor", "user", "iphoneXStyle", "priceColor" ])),
                data: function() {
                    var e;
                    return _(e = {
                        isaddress: !1,
                        maskState: 0,
                        payType: 1,
                        addressData: {},
                        good_arr: [],
                        orderComputeInfo: {},
                        countAllMoney: 0,
                        submitInfo: {},
                        payData: {
                            type: 1,
                            money: "",
                            pay: ""
                        },
                        res: ""
                    }, "payType", 1), _(e, "total_price", 0), _(e, "type", ""), _(e, "isPay", -1), _(e, "isShow", !1), 
                    _(e, "show", !1), _(e, "good_type", ""), _(e, "order_id", ""), _(e, "isShowYunFei", !1), 
                    _(e, "url", ""), _(e, "isAdress", ""), _(e, "scene", ""), _(e, "formShow", !1), 
                    _(e, "is_form", 0), _(e, "form_data", ""), _(e, "form_id", ""), e;
                },
                watch: {},
                created: function() {
                    this.isPayType();
                },
                onLoad: function(t) {
                    var o = this;
                    if (o.url = "/shop/address/addressList?types=" + t.type + "&good_type=" + t.good_type + "&type=3", 
                    y = this, !(0, a.isEmpty)(t)) {
                        this.type = t.type, this.good_type = t.good_type;
                        (0, s.getCache)({
                            key: "cart"
                        }).then(function(t) {
                            o.good_arr = JSON.parse(t), o.isShow = !0, 1 == o.good_arr.length && 1 == o.good_arr[0].is_form ? (o.is_form = o.good_arr[0].is_form, 
                            o.form_id = o.good_arr[0].form_id, o.formShow = !0) : o.good_arr.length > 1 && 0 != o.configs.shop_form_id || 0 == o.good_arr[0].is_form && 0 != o.configs.shop_form_id ? (o.is_form = 1, 
                            o.form_id = o.configs.shop_form_id, o.formShow = !0) : o.formShow = !1, o.is_form && o.$nextTick(function() {
                                o.$refs.formOrder.getForm(o.form_id, 6);
                            }), e.removeStorage({
                                key: "address" + n.default.uniacid,
                                success: function(e) {
                                    1 == o.good_type ? o.getAddressList() : o.calculationFun();
                                },
                                fail: function(e) {
                                    1 == o.good_type ? o.getAddressList() : o.calculationFun();
                                }
                            });
                        });
                    }
                },
                onShow: function() {
                    var e = this;
                    e.scene = wx.getLaunchOptionsSync().scene, (0, p.getStorageSync)("address").then(function(t) {
                        (0, a.isEmpty)(JSON.parse(t.data)) ? (0, a.isEmpty)(JSON.parse(t.data)) && (e.isaddress = !1) : (e.addressData = JSON.parse(t.data), 
                        e.isaddress = !0, e.newOrder());
                    }, function(e) {});
                },
                onHide: function() {
                    e.removeStorage({
                        key: "address" + n.default.uniacid,
                        success: function(e) {},
                        fail: function(e) {}
                    });
                },
                onUnload: function() {
                    e.removeStorage({
                        key: "address" + n.default.uniacid,
                        success: function(e) {},
                        fail: function(e) {}
                    });
                },
                methods: {
                    checks: function() {
                        this.$refs.formOrder.Order();
                    },
                    Orders: function(e) {
                        this.form_data = e, this.submit();
                    },
                    putOrder: (0, c.throttle)(function() {
                        1 == y.is_form ? y.$refs.formOrder.check() : y.submit();
                    }, 1500),
                    isPayType: function() {
                        var e = this;
                        (0, d.payMethod)().then(function(t) {
                            -1 == t.indexOf("wxpay") && (e.isPay = 0);
                        });
                    },
                    choosePay: function(e) {
                        this.isPay = 1 == e.typeId ? 3 : 2, this.submit();
                    },
                    getAddressList: function() {
                        var e = this, t = this;
                        (0, s.defaultMyAddress)({}).then(function(o) {
                            var r = 0;
                            if ((0, a.isEmpty)(o.id)) {
                                for (var i = 0; i < e.good_arr.length; i++) r = parseFloat(parseFloat(r) + parseFloat(e.good_arr[i].item.total_price));
                                t.total_price = parseFloat(r).toFixed(2);
                            } else t.isaddress = !0, t.addressData = o, t.newOrder();
                            t.isShow = !0;
                        });
                    },
                    newOrder: function() {
                        var e = this, t = {
                            good_arr: this.good_arr,
                            province_id: this.addressData.province_id,
                            city_id: this.addressData.city_id,
                            district_id: this.addressData.district_id
                        };
                        (0, s.beforSubmitOrder)(t).then(function(t) {
                            e.orderComputeInfo = t, e.isShowYunFei = !0, e.calculationFun();
                        });
                    },
                    calculationFun: function() {
                        for (var e = 0, t = 0; t < this.good_arr.length; t++) e = parseFloat(parseFloat(e) + parseFloat(this.good_arr[t].item.total_price));
                        this.total_price = parseFloat(e).toFixed(2), this.countAllMoney = 1 == this.good_type ? parseFloat(parseFloat(e) + parseFloat(this.orderComputeInfo.postage)).toFixed(2) : parseFloat(e);
                    },
                    numberChange: function(e) {
                        this.number = e.number;
                    },
                    changePayType: function(e) {
                        this.payType = e;
                    },
                    submit: function() {
                        var e = this;
                        this.isaddress || 1 != e.good_type ? this.countAllMoney && 0 != this.countAllMoney && (0, 
                        f.h5JudgeLogin)(2).then(function(t) {
                            t || e.submitOrder();
                        }) : this.$toast("请选择地址", "none");
                    },
                    submitOrder: function() {
                        var e = this;
                        if (!this.countAllMoney) return !1;
                        if ((0, a.isEmpty)(e.addressData.province_id) && 1 == e.good_type) return e.$toast("地址不能为空", "none");
                        if (0 == e.isPay) return e.$toast("未设置支付方式", "none"), !1;
                        var t = {
                            type: e.type,
                            good_arr: e.good_arr,
                            name: e.addressData.name,
                            phone: e.addressData.phone,
                            address: e.addressData.province + e.addressData.city + e.addressData.district + e.addressData.detail,
                            province_id: 1 == e.good_type ? e.addressData.province_id : 0,
                            city_id: 1 == e.good_type ? e.addressData.city_id : 0,
                            district_id: 1 == e.good_type ? e.addressData.district_id : 0,
                            payType: 1,
                            postage: 1 == e.good_type ? e.orderComputeInfo.postage : 0,
                            remark: e.submitInfo.remark,
                            order_id: "",
                            good_type: e.good_type,
                            scene: e.scene,
                            is_form: e.is_form,
                            form_id: e.form_id,
                            form_data: e.form_data
                        };
                        e.show = !0, (0, s.submitGoodOrder)(t).then(function(t) {
                            e.order_id = t.order_id, e.show = !1, (0, a.checkScene)(e.scene) ? (0, u.pay)(t, e.orderSuccess, e.orderFail, "scene") : (0, 
                            u.pay)(t, e.orderSuccess, e.orderFail, "");
                        });
                    },
                    orderSuccess: function(e) {
                        (0, i.route)({
                            url: "/pages/result/result?type=2&op=1",
                            type: 3,
                            data: {
                                id: this.order_id,
                                order_id: this.order_id
                            }
                        });
                    },
                    orderFail: function(e) {
                        console.log("失败啦!");
                    },
                    stopPrevent: function() {}
                }
            };
            t.default = h;
        }).call(this, o("543d").default);
    },
    "7a59": function(e, t, o) {
        var r = o("d1b9");
        o.n(r).a;
    },
    d1b9: function(e, t, o) {},
    f361: function(e, t, o) {
        o.r(t);
        var r = o("0f35"), a = o("0976");
        for (var i in a) "default" !== i && function(e) {
            o.d(t, e, function() {
                return a[e];
            });
        }(i);
        o("7a59");
        var n = o("f0c5"), s = Object(n.a)(a.default, r.b, r.c, !1, null, "4a3e5cde", null, !1, r.a, void 0);
        t.default = s.exports;
    }
}, [ [ "1573", "common/runtime", "common/vendor" ] ] ]);